from day03.apps.task1 import add, subtract
from day03.apps.task2 import multiply, devide


"""
不指定队列名，随机消费
celery -A day03.apps worker -l INFO -n work01@h
celery -A day03.apps worker -l INFO -n work02@h
"""
# if __name__ == '__main__':
#     add.delay(10, 5)
#     subtract.delay(10, 5)
#     multiply.delay(10, 5)
#     devide.delay(10, 5)


"""
配置多个队列，启动多个worker
celery -A day03.apps worker -l INFO -n worker01@h -Q apps_task1
celery -A day03.apps worker -l INFO -n worker02@h -Q apps_task2

1.apply_async(queue=队列名)
2.app.task(queue=队列名)
"""
# if __name__ == '__main__':
#     add.delay(10, 5)
#     subtract.apply_async(args=(10, 5), queue='apps_task1')
#     multiply.delay(10, 5)
#     devide.apply_async(args=(10, 5), queue='apps_task2')


"""
配置多个队列，启动多个worker
celery -A day03.apps worker -l INFO -n worker01@h -Q apps_task1
celery -A day03.apps worker -l INFO -n worker02@h -Q apps_task2

3.配置文件的方式
"""
if __name__ == '__main__':
    add.delay(10, 5)
    subtract.delay(10, 5)
    multiply.delay(10, 5)
    devide.delay(10, 5)
